[C language exploration journey] Part 1 Lesson 4 Chapter 2: Variable Declaration of the world of variables Chapter 2
Introduction
1. Course outline
2. Part 1 Lesson 4 Chapter 2: Variable Declaration of the world of Variables
3. Part 1 Lesson 4
1, can local variables and global variable duplicate?
A: Yes, the local will screen the overall situation. To use a global variable, you need to use the "::"
Local variables can have the same name as global variables, and when referenced within a
C language variable declaration problem-must variable definitions be placed at the top of all execution statements/statement blocks ?, The beginning of the Variable
Error message: error C2065: 'salary ': undeclared identifier
# Include void main (
First, the basic type
The size of the 1.c language integer type is not precisely defined, but varies with the type of compiler, and ANSI C guarantees only the minimum size of the data. Char>=8 bit, short>=16 bit, int>=16 bit, long>=32 bit.
2.
variable declarations and variable definitions
Variable definitions: Used to allocate storage space for a variable, and to specify an initial value for a variable. In a program, a variable has and has only one definition.
Variable declaration: Used
compiler compiles a program, it compiles only one source file and generates the corresponding intermediate file (for the VC, the. obj file), and then the connector unifies all intermediate files to form an executable file. The problem is that when
About the declarations and definitions of C + + variablesAs we already know, a function generally consists of two parts: the declaration part and the execution statement.
The role of the Declarations section is to describe the properties of the
CThe declaration of a name in a language is the identification of an identifier with aCassociated with a language object, such as a variable, function, or type,Cthe names that can be declared in a language include: variables, functions, types, type
The C language itself provides a less explicit way of declaring variables-based on the use of declarations, such as int *a, which essentially declares the type of *a to be int, so a pointer to an int is obtained. For simple types, this declaration
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.